From 97e30d9bdfef30780bd432494df75dd5355516f2 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 1 Sep 2008 15:05:25 +0000 Subject: [PATCH] Fix r40194, which was obviously incorrect. There's no reason $sectionTitle should be valid, so you should probably check to see if Title::newFromText() succeeded, rather than checking the validity of some unrelated variable. Also: use the new three-parameter Title::makeTitleSafe(), instead of cloning and setting mFragment directly. --- includes/Linker.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index 3f8f802fda..cc02241410 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1219,13 +1219,10 @@ class Linker { if ( $local ) { $sectionTitle = Title::newFromText( '#' . $section ); } else { - $sectionTitle = clone( $title ); - $sectionTitle->mFragment = $section; + $sectionTitle = Title::makeTitleSafe( $title->getNamespace(), + $title->getDBkey(), $section ); } - # FIXME: $sectionTitle should probably always be valid at this - # point, but in some scenarios it's not (bug 15351). Is this cor- - # rect? - if( $title instanceof Title ) { + if ( $sectionTitle ) { $link = $this->link( $sectionTitle, wfMsgForContent( 'sectionlink' ), array(), array(), 'noclasses' ); -- 2.20.1